home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 1_2002.ISO / Data / Zips / [_[_A_Perl69538462002.psc / Form1.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  2001-07-13  |  26.0 KB  |  1,014 lines

  1. VERSION 5.00
  2. Object = "{3B7C8863-D78F-101B-B9B5-04021C009402}#1.2#0"; "richtx32.ocx"
  3. Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
  4. Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
  5. Begin VB.Form Form1 
  6.    Caption         =   "Form1"
  7.    ClientHeight    =   5565
  8.    ClientLeft      =   3765
  9.    ClientTop       =   3975
  10.    ClientWidth     =   7575
  11.    Icon            =   "Form1.frx":0000
  12.    LinkTopic       =   "Form1"
  13.    ScaleHeight     =   5565
  14.    ScaleWidth      =   7575
  15.    Begin RichTextLib.RichTextBox R2 
  16.       Height          =   1815
  17.       Left            =   4800
  18.       TabIndex        =   5
  19.       Top             =   3360
  20.       Visible         =   0   'False
  21.       Width           =   2415
  22.       _ExtentX        =   4260
  23.       _ExtentY        =   3201
  24.       _Version        =   393217
  25.       Enabled         =   -1  'True
  26.       TextRTF         =   $"Form1.frx":0442
  27.    End
  28.    Begin VB.Timer Timer2 
  29.       Interval        =   500
  30.       Left            =   480
  31.       Top             =   1920
  32.    End
  33.    Begin VB.TextBox Text3 
  34.       Height          =   375
  35.       Left            =   6240
  36.       TabIndex        =   4
  37.       Text            =   "0"
  38.       Top             =   1200
  39.       Visible         =   0   'False
  40.       Width           =   375
  41.    End
  42.    Begin VB.TextBox Text2 
  43.       Height          =   375
  44.       Left            =   6240
  45.       TabIndex        =   3
  46.       Text            =   "0"
  47.       Top             =   600
  48.       Visible         =   0   'False
  49.       Width           =   375
  50.    End
  51.    Begin VB.TextBox Text1 
  52.       Height          =   375
  53.       Left            =   6000
  54.       TabIndex        =   2
  55.       Top             =   0
  56.       Visible         =   0   'False
  57.       Width           =   1335
  58.    End
  59.    Begin VB.Timer Timer1 
  60.       Interval        =   100
  61.       Left            =   480
  62.       Top             =   1440
  63.    End
  64.    Begin MSComctlLib.StatusBar StatusBar1 
  65.       Align           =   2  'Align Bottom
  66.       Height          =   255
  67.       Left            =   0
  68.       TabIndex        =   1
  69.       Top             =   5310
  70.       Width           =   7575
  71.       _ExtentX        =   13361
  72.       _ExtentY        =   450
  73.       _Version        =   393216
  74.       BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628} 
  75.          NumPanels       =   5
  76.          BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
  77.             AutoSize        =   2
  78.          EndProperty
  79.          BeginProperty Panel2 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
  80.          EndProperty
  81.          BeginProperty Panel3 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
  82.             AutoSize        =   2
  83.          EndProperty
  84.          BeginProperty Panel4 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
  85.             Style           =   1
  86.             AutoSize        =   2
  87.             Enabled         =   0   'False
  88.             TextSave        =   "CAPS"
  89.          EndProperty
  90.          BeginProperty Panel5 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
  91.             AutoSize        =   2
  92.          EndProperty
  93.       EndProperty
  94.    End
  95.    Begin MSComDlg.CommonDialog dlgOpenFile 
  96.       Left            =   480
  97.       Top             =   2400
  98.       _ExtentX        =   847
  99.       _ExtentY        =   847
  100.       _Version        =   393216
  101.    End
  102.    Begin RichTextLib.RichTextBox R1 
  103.       Height          =   5535
  104.       Left            =   0
  105.       TabIndex        =   0
  106.       Top             =   0
  107.       Width           =   7575
  108.       _ExtentX        =   13361
  109.       _ExtentY        =   9763
  110.       _Version        =   393217
  111.       BorderStyle     =   0
  112.       Enabled         =   -1  'True
  113.       ScrollBars      =   3
  114.       DisableNoScroll =   -1  'True
  115.       RightMargin     =   50000
  116.       TextRTF         =   $"Form1.frx":052E
  117.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  118.          Name            =   "Fixedsys"
  119.          Size            =   9
  120.          Charset         =   0
  121.          Weight          =   400
  122.          Underline       =   0   'False
  123.          Italic          =   0   'False
  124.          Strikethrough   =   0   'False
  125.       EndProperty
  126.    End
  127.    Begin VB.Menu File 
  128.       Caption         =   "File"
  129.       Begin VB.Menu New 
  130.          Caption         =   "New"
  131.       End
  132.       Begin VB.Menu Open 
  133.          Caption         =   "Open"
  134.       End
  135.       Begin VB.Menu Save 
  136.          Caption         =   "Save"
  137.       End
  138.       Begin VB.Menu SaveAs 
  139.          Caption         =   "Save As"
  140.       End
  141.    End
  142.    Begin VB.Menu Edit 
  143.       Caption         =   "Edit"
  144.       Begin VB.Menu Copyprivate 
  145.          Caption         =   "Copy private"
  146.       End
  147.       Begin VB.Menu Pasteprivate 
  148.          Caption         =   "Paste private"
  149.       End
  150.       Begin VB.Menu Copy 
  151.          Caption         =   "Copy"
  152.       End
  153.       Begin VB.Menu Paste 
  154.          Caption         =   "Paste"
  155.       End
  156.       Begin VB.Menu Cut 
  157.          Caption         =   "Cut"
  158.       End
  159.       Begin VB.Menu Undo 
  160.          Caption         =   "Undo"
  161.       End
  162.       Begin VB.Menu Selectall 
  163.          Caption         =   "Select All"
  164.       End
  165.       Begin VB.Menu Find 
  166.          Caption         =   "Find"
  167.       End
  168.       Begin VB.Menu Addseltexttobatch 
  169.          Caption         =   "Add seltext to batch replacelist"
  170.       End
  171.       Begin VB.Menu separ1 
  172.          Caption         =   "-"
  173.       End
  174.       Begin VB.Menu Curseltext 
  175.          Caption         =   "---> Current seltext: "
  176.       End
  177.    End
  178.    Begin VB.Menu Insert 
  179.       Caption         =   "Insert"
  180.       Begin VB.Menu printheader 
  181.          Caption         =   "Print Header -- Content ty..."
  182.       End
  183.       Begin VB.Menu Start 
  184.          Caption         =   "Start"
  185.       End
  186.       Begin VB.Menu Readinputlink 
  187.          Caption         =   "Read input link"
  188.       End
  189.       Begin VB.Menu Readinputfromform 
  190.          Caption         =   "Read input from form"
  191.       End
  192.       Begin VB.Menu Foreach 
  193.          Caption         =   "Foreach"
  194.       End
  195.       Begin VB.Menu Splitx 
  196.          Caption         =   "Split"
  197.       End
  198.       Begin VB.Menu Openfile 
  199.          Caption         =   "Open file"
  200.       End
  201.       Begin VB.Menu addarrycell 
  202.          Caption         =   "Add array cell"
  203.       End
  204.       Begin VB.Menu arraysize 
  205.          Caption         =   "Array size"
  206.       End
  207.       Begin VB.Menu if 
  208.          Caption         =   "if"
  209.       End
  210.       Begin VB.Menu ifelse 
  211.          Caption         =   "if else"
  212.       End
  213.       Begin VB.Menu aortarray 
  214.          Caption         =   "Sort array"
  215.       End
  216.    End
  217.    Begin VB.Menu Convert 
  218.       Caption         =   "Convert"
  219.       Begin VB.Menu ToPerl 
  220.          Caption         =   "To Perl"
  221.          Shortcut        =   ^P
  222.       End
  223.       Begin VB.Menu ToHTML 
  224.          Caption         =   "To HTML"
  225.          Shortcut        =   ^H
  226.       End
  227.    End
  228.    Begin VB.Menu Lock 
  229.       Caption         =   "Lock"
  230.       Begin VB.Menu Setlockatcurrentline 
  231.          Caption         =   "Set lock at current line"
  232.       End
  233.       Begin VB.Menu Gotolockedline 
  234.          Caption         =   "Go to locked line"
  235.       End
  236.    End
  237.    Begin VB.Menu Codecolor 
  238.       Caption         =   "Code color"
  239.       Begin VB.Menu Update 
  240.          Caption         =   "Update"
  241.       End
  242.       Begin VB.Menu Reset 
  243.          Caption         =   "Reset"
  244.       End
  245.       Begin VB.Menu codecolen 
  246.          Caption         =   "Codecolor Enabled"
  247.       End
  248.    End
  249.    Begin VB.Menu View 
  250.       Caption         =   "View"
  251.       Begin VB.Menu Variables 
  252.          Caption         =   "Variables"
  253.       End
  254.    End
  255.    Begin VB.Menu Batch 
  256.       Caption         =   "Batch"
  257.       Begin VB.Menu Replaceinselectedfiles 
  258.          Caption         =   "Replace in selected files"
  259.       End
  260.    End
  261.    Begin VB.Menu Syntax 
  262.       Caption         =   "Syntax"
  263.       Begin VB.Menu Checksyntax 
  264.          Caption         =   "Check Syntax"
  265.       End
  266.    End
  267. Attribute VB_Name = "Form1"
  268. Attribute VB_GlobalNameSpace = False
  269. Attribute VB_Creatable = False
  270. Attribute VB_PredeclaredId = True
  271. Attribute VB_Exposed = False
  272. Option Explicit
  273. Dim saveit As Boolean
  274. Dim xxx As String
  275. Dim resp As String
  276. Dim gblnIgnoreChange As Boolean
  277. Dim gintIndex As Integer
  278. Dim gstrStack(1000) As String
  279. Dim selholder
  280. Dim selmid
  281. Dim clicker
  282. Dim selstartx
  283. Dim sellenghtx
  284. Dim strOpen As String
  285. Dim returnval As Integer
  286. Dim thechar As String
  287. Dim textholder As String
  288. Dim linelock As String
  289. Public Sub GotoLine(LineNum, Highlight As Boolean)
  290.     On Error GoTo done:
  291.   Dim temp As Integer
  292.   Dim Num As Integer
  293.   Dim Pos  As Integer
  294.   Dim LastPos As Integer
  295.   Dim Cut As Integer
  296.     If LineNum = 0 Then Exit Sub
  297.     Pos = 1
  298.     Num = 1
  299.     temp = 0
  300.     Do
  301.         LastPos = temp
  302.         temp = InStr(Pos, R1.Text, vbCrLf)
  303.         If temp = 0 Then GoTo Redo:
  304.         If temp >= 1 Then
  305.             Num = Num + 1
  306.             Pos = temp + 2
  307.         End If
  308.     Loop Until Num >= LineNum
  309.     Cut = 1
  310. Redo:
  311.     If temp = 0 Then
  312.         LastPos = 0
  313.         temp = Len(R1.Text)
  314.         Cut = 0
  315.     End If
  316.     If LineNum = 1 Then
  317.         temp = 0
  318.         LastPos = InStr(1, R1.Text, vbCrLf)
  319.         If LastPos = 0 Then
  320.             LastPos = Len(R1.Text)
  321.         End If
  322.         Cut = 0
  323.     End If
  324.     R1.SelStart = temp
  325.     If Highlight = True Then R1.SelLength = LastPos - Cut
  326.    R1.SetFocus
  327. done:
  328. End Sub
  329. Private Sub addarrycell_Click()
  330. R1.SelText = "$arrayname[++$#arrayname] = $var;" & vbCrLf
  331. End Sub
  332. Private Sub Addseltexttobatch_Click()
  333. If Len(selholder) > 0 Then
  334. Replacelist.List1.AddItem selholder, 0
  335. Replacelist.List2.AddItem selholder, 0
  336. End If
  337. End Sub
  338. Private Sub aortarray_Click()
  339. R1.SelText = "@array = sort @array;" & vbCrLf
  340. End Sub
  341. Private Sub arraysize_Click()
  342. R1.SelText = "$var = @array;" & vbCrLf
  343. End Sub
  344. Private Sub Checksyntax_Click()
  345. frmSyntax.Show
  346. End Sub
  347. Private Sub codecolen_Click()
  348. If codecolen.Checked = True Then
  349. codecolen.Checked = False
  350. Reset_Click
  351. codecolen.Checked = True
  352. Update_Click
  353. End If
  354. End Sub
  355. Private Sub Copy_Click()
  356.     Clipboard.Clear
  357.     Clipboard.SetText R1.SelText
  358.     R1.SetFocus
  359. End Sub
  360. Private Sub Copyprivate_Click()
  361. 'textholder = R1.SelText
  362. Form5.List1.AddItem R1.SelText, 0
  363. End Sub
  364. Private Sub Cut_Click()
  365.     Clipboard.Clear
  366.     Clipboard.SetText R1.SelText
  367.     R1.SelText = ""
  368.     R1.SetFocus
  369. End Sub
  370. Private Sub Find_Click()
  371. Form4.Show
  372. End Sub
  373. Private Sub Foreach_Click()
  374. resp = InputBox("insert Array to use: e.g @array", _
  375. "Enter Array", "@array")
  376. If resp = "" Then
  377. xxx = "foreach $i (" + resp + ") {" + vbCrLf + _
  378. "chomp($i);" + vbCrLf + vbCrLf + _
  379. "}" + vbCrLf
  380. Clipboard.SetText xxx
  381. R1.SelText = Clipboard.GetText
  382. End If
  383. End Sub
  384. Private Sub Form_Load()
  385. selstartx = 0
  386. sellenghtx = 0
  387. clicker = 1
  388. Form1.Caption = "Untitled1.txt"
  389. saveit = False
  390. Form_Resize
  391. linelock = 1
  392. Dim i
  393. For i = 0 To 49
  394. starttext(i) = "x11111111111111111111111111"
  395. End Sub
  396. Private Sub Form_Resize()
  397. 'Vars.Left = Form1.Width - Vars.Width
  398. If Form1.Width > 120 And Form1.Height > 720 Then
  399. R1.Width = Form1.Width - 120
  400. R1.Height = Form1.Height - 975
  401. End If
  402. If Form1.WindowState = 1 Then
  403. Vars.Hide
  404. If Vars.List1.ListCount > 0 Then
  405. Vars.Show
  406. End If
  407. End If
  408. End Sub
  409. Private Sub Form_Unload(Cancel As Integer)
  410. If saveit = True Then
  411. If strOpen = "" Then
  412. strOpen = "Untitled1.txt"
  413. End If
  414. resp = MsgBox("Save " + strOpen, vbYesNo)
  415. If strOpen = "Untitled1.txt" Then
  416. strOpen = ""
  417. End If
  418. If resp = vbYes Then
  419. If strOpen = "" Then
  420. SaveAs_Click
  421. Save_Click
  422. End If
  423. End If
  424. End If
  425. End Sub
  426. Private Sub Gotolockedline_Click()
  427. 'Dim i As Long
  428. 'R1.SelStart = 0
  429. 'R1.SelLength = 0
  430. 'R1.SelText = ""
  431. GotoLine linelock + 1, False
  432. 'For i = 1 To linelock - 1
  433. 'SendKeys "{DOWN}", True
  434. 'Next
  435. 'SendKeys "{RIGHT}", True
  436. 'SendKeys "{LEFT}", True
  437. SendKeys "+{HOME}", True
  438. End Sub
  439. Private Sub if_Click()
  440. R1.SelText = "if (){" & vbCrLf & vbCrLf & "}" & vbCrLf
  441. End Sub
  442. Private Sub ifelse_Click()
  443. R1.SelText = "if (){" & vbCrLf & vbCrLf & "}else{" & vbCrLf & vbCrLf & "}" & vbCrLf
  444. End Sub
  445. Private Sub New_Click()
  446. If saveit = True Then
  447. If strOpen = "" Then
  448. strOpen = "Untitled1.txt"
  449. End If
  450. resp = MsgBox("Save " + strOpen, vbYesNo)
  451. If strOpen = "Untitled1.txt" Then
  452. strOpen = ""
  453. End If
  454. If resp = vbYes Then
  455. If strOpen = "" Then
  456. SaveAs_Click
  457. Save_Click
  458. End If
  459. End If
  460. End If
  461. R1.Text = ""
  462. End Sub
  463. Private Sub Open_Click()
  464. linelock = 1
  465. StatusBar1.Panels(3) = ""
  466. dlgOpenFile.Filter = "*.pl Perl files|*.pl|*.txt Text Files|*.txt|*.* All Files|*.*"
  467.    dlgOpenFile.ShowOpen
  468.    strOpen = dlgOpenFile.FileName
  469.    R1.LoadFile strOpen, rtfText
  470. Form1.Caption = dlgOpenFile.FileTitle + " Path: " + strOpen
  471. saveit = False
  472. Update_Click
  473. End Sub
  474. Private Sub Openfile_Click()
  475. Form3.Show
  476. End Sub
  477. Private Sub Paste_Click()
  478.     'Dim pastepos
  479.     'Dim cliplenght
  480.     'Dim i
  481.     'pastepos = R1.SelStart
  482.     'cliplenght = Len(Clipboard.GetText)
  483.     R1.SelText = Clipboard.GetText
  484.     'R1.SelStart = pastepos
  485.     'Update_Click
  486. 'R1.SetFocus
  487. 'For i = 1 To cliplenght
  488. 'SendKeys "{RIGHT}"
  489. 'Next
  490. End Sub
  491. Private Sub Pasteprivate_Click()
  492. 'R1.SelText = textholder
  493. Form5.Top = ycoord + Form1.Top + 1000
  494. Form5.Left = xcoord + Form1.Left + 500
  495. Form5.Show
  496. End Sub
  497. Private Sub printheader_Click()
  498. R1.SelText = "print ""Content-Type: text/html; charset=iso-8859-1\n\n"";" & vbCrLf
  499. End Sub
  500. Private Sub R1_Change()
  501.  On Error Resume Next
  502.     saveit = True
  503.     If Not gblnIgnoreChange Then
  504.         gintIndex = gintIndex + 1
  505.        gstrStack(gintIndex) = R1.TextRTF
  506.     End If
  507. 'checkcolor
  508. End Sub
  509. Private Sub R1_Click()
  510. 'Text4.Text = Len(R1.Text)
  511. Form5.Hide
  512. thechar = R1.SelStart
  513.     Dim currLine As Long
  514.     On Local Error Resume Next
  515.     currLine = SendMessage(R1.hwnd, EM_LINEFROMCHAR, -1&, ByVal 0&) + 1
  516.     'MsgBox Format$(currLine, "##,###")
  517.  StatusBar1.Panels(1).Text = "Line: " + Format$(currLine, "##,###")
  518. Dim currentp
  519. Dim i
  520. Dim foundstr
  521. Dim currchar
  522. currentp = thechar
  523. If R1.SelLength > 0 Then
  524. Exit Sub
  525. End If
  526. R1.SelColor = QBColor(0)
  527. If thechar = 0 Then
  528. Exit Sub
  529. End If
  530. For i = 0 To 25
  531. If thechar - i = 0 Then
  532. Exit For
  533. End If
  534. currchar = Mid(R1.Text, thechar - i, 1)
  535. If currchar = "{" Or _
  536. currchar = " " Or _
  537. currchar = ")" Or _
  538. currchar = "," Or _
  539. currchar = "/" Or _
  540. currchar = "]" Or _
  541. currchar = Chr(34) Or _
  542. currchar = "'" Or _
  543. currchar = "<" Or _
  544. currchar = ";" Or _
  545. currchar = "\" Or _
  546. currchar = "-" Or _
  547. currchar = "." Or _
  548. currchar = ":" Or _
  549. currchar = "(" Or _
  550. currchar = "}" Or _
  551. currchar = "[" Or _
  552. currchar = vbCrLf Or _
  553. currchar = vbLf Or _
  554. currchar = "#" Then
  555. Exit For
  556. End If
  557. Text2.Text = thechar - i
  558. For i = 0 To 25
  559. If thechar - i = 0 Then
  560. Exit For
  561. End If
  562. currchar = Mid(R1.Text, thechar + i, 1)
  563. If currchar = "{" Or _
  564. currchar = " " Or _
  565. currchar = ")" Or _
  566. currchar = "," Or _
  567. currchar = "/" Or _
  568. currchar = "]" Or _
  569. currchar = Chr(34) Or _
  570. currchar = "'" Or _
  571. currchar = "<" Or _
  572. currchar = ";" Or _
  573. currchar = "\" Or _
  574. currchar = "-" Or _
  575. currchar = "." Or _
  576. currchar = ":" Or _
  577. currchar = "(" Or _
  578. currchar = "}" Or _
  579. currchar = "[" Or _
  580. currchar = vbCrLf Or _
  581. currchar = vbLf Or _
  582. currchar = "#" Then
  583. Exit For
  584. End If
  585. Text3.Text = currentp + i
  586. 'If Not Text2.Text = Text3.Text Then
  587. R1.SelStart = Text2.Text
  588. R1.SelLength = Text3.Text - Text2.Text
  589. Text1.Text = R1.SelText
  590. 'End If
  591. Text1.Text = Replace(Text1.Text, vbCrLf, "", 1, -1, vbTextCompare)
  592. Dim finder
  593. finder = InStr(1, Text1.Text, "$", vbTextCompare)
  594. If finder > 0 Then
  595. R1.SelStart = Text2.Text + (finder - 1)
  596. R1.SelLength = Len(Text1.Text) - finder + clicker
  597. End If
  598. If finder > 0 Then
  599. R1.SelColor = &HC000&
  600. 'Unload mnuHello(mnuHello.Count)
  601. R1.SelColor = QBColor(0)
  602. End If
  603. 'Text1.Text = Trim(Text1.Text)
  604. If Text1.Text = "open " Then
  605. R1.SelColor = QBColor(9)
  606. End If
  607. If Text1.Text = "open" Then
  608. R1.SelColor = QBColor(9)
  609. End If
  610. If Text1.Text = "print" Then
  611. R1.SelColor = QBColor(9)
  612. End If
  613. If Text1.Text = "print " Then
  614. R1.SelColor = QBColor(9)
  615. End If
  616. If Text1.Text = "close" Then
  617. R1.SelColor = QBColor(9)
  618. End If
  619. If Text1.Text = "close " Then
  620. R1.SelColor = QBColor(9)
  621. End If
  622. If Text1.Text = "if " Then
  623. R1.SelColor = QBColor(9)
  624. End If
  625. If Text1.Text = "if" Then
  626. R1.SelColor = QBColor(9)
  627. End If
  628. If Text1.Text = "else " Then
  629. R1.SelColor = QBColor(9)
  630. End If
  631. If Text1.Text = "else" Then
  632. R1.SelColor = QBColor(9)
  633. End If
  634. If Text1.Text = "elsif " Then
  635. R1.SelColor = QBColor(9)
  636. End If
  637. If Text1.Text = "elsif" Then
  638. R1.SelColor = QBColor(9)
  639. End If
  640. '0 Black
  641. '1 Blue
  642. '2 Green
  643. '3 Cyan
  644. '4 Red
  645. '5 Magenta
  646. '6 Yellow
  647. '7 White
  648. '8 Gray
  649. '9 Light Blue
  650. '10 Light Green
  651. '11 Light Cyan
  652. '12 Light Red
  653. '13 Light Magenta
  654. '14 Light Yellow
  655. '15 Bright White
  656. R1.SelLength = 0
  657. R1.SelStart = thechar
  658. R1.SelColor = QBColor(0)
  659. clicker = 1
  660. End Sub
  661. Private Sub Redo_Click()
  662.     gblnIgnoreChange = True
  663.     gintIndex = gintIndex + 1
  664.     On Error Resume Next
  665.     R1.TextRTF = gstrStack(gintIndex)
  666.     gblnIgnoreChange = False
  667. End Sub
  668. Private Sub R1_KeyPress(KeyAscii As Integer)
  669. 'Form1.Caption = KeyAscii
  670. If Not KeyAscii And vbCtrlMask Then
  671. 'Update_Click
  672. End If
  673. 'colorword "open", 0, &H80FF&, KeyAscii
  674. 'colorword "close", 1, &HFF8080, KeyAscii
  675. If KeyAscii = 41 Then
  676. R1.SelColor = &H0&
  677. ElseIf KeyAscii = 44 Then
  678. R1.SelColor = &H0&
  679. 'Else
  680. 'R1.SelColor = &H0&
  681. End If
  682. End Sub
  683. Private Sub R1_KeyUp(KeyCode As Integer, Shift As Integer)
  684. If KeyCode = 37 Or KeyCode = 38 Or KeyCode = 39 Or KeyCode = 40 Then
  685. clicker = 0
  686. End If
  687. R1_Click
  688. End Sub
  689. Private Sub R1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  690. If Button = 2 And Shift = 0 Then
  691. Me.PopupMenu Edit
  692. End If
  693. If Button = 2 And Shift = 1 Then
  694. Me.PopupMenu Insert
  695. End If
  696. clicker = 0
  697. End Sub
  698. Private Sub R1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  699. xcoord = X
  700. ycoord = Y
  701. End Sub
  702. Private Sub Readinputfromform_Click()
  703. xxx = "read(STDIN, $buffer, $ENV{""CONTENT_LENGTH""});" + _
  704. vbCrLf + "@pairs = split(/&/, $buffer);" + _
  705. vbCrLf + "foreach $pair (@pairs) {local($name, $value) = split(/=/, $pair);" + _
  706. vbCrLf + "$name =~ tr/+/ /;" + _
  707. vbCrLf + "$name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack(""C"", hex($1))/eg;" + _
  708. vbCrLf + "$value =~ tr/+/ /;" + _
  709. vbCrLf + "$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack(""C"", hex($1))/eg;" + _
  710. vbCrLf + "$co{$name} = $value;" + vbCrLf
  711. R1.SelText = xxx
  712. End Sub
  713. Private Sub Readinputlink_Click()
  714. xxx = "$querystring = $ENV{""QUERY_STRING""};" + _
  715. vbCrLf + "$queryhold = $ENV{""QUERY_STRING""};" + _
  716. vbCrLf + "$querystring =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack(""C"", hex($1))/eg;" + _
  717. vbCrLf + "$querystring =~ tr/+/ /;" + vbCrLf
  718. R1.SelText = xxx
  719. sellenghtx = Len(xxx)
  720. End Sub
  721. Private Sub Replaceinselectedfiles_Click()
  722. Batchfiles.Show
  723. End Sub
  724. Private Sub Reset_Click()
  725. R1.SelStart = 0
  726. R1.SelLength = Len(R1.Text)
  727. R1.SelColor = &H0&
  728. R1.SelStart = 0
  729. R1.SetFocus
  730. End Sub
  731. Private Sub Save_Click()
  732. R1.SaveFile strOpen, rtfText
  733. saveit = False
  734. End Sub
  735. Private Sub SaveAs_Click()
  736.    Dim strNewFile As String
  737.    dlgOpenFile.Filter = "*.pl Perl files|*.pl|*.txt Text Files|*.txt|*.* All Files|*.*"
  738.    dlgOpenFile.ShowSave
  739.    strNewFile = dlgOpenFile.FileName
  740.    R1.SaveFile strNewFile, rtfText
  741. Form1.Caption = dlgOpenFile.FileTitle + " Path: " + strOpen
  742. End Sub
  743. Private Sub Selectall_Click()
  744.     R1.SelStart = 0
  745.     R1.SelLength = Len(R1.Text)
  746.     R1.SetFocus
  747. End Sub
  748. Private Sub Setlockatcurrentline_Click()
  749.     Dim currLine As Long
  750.     On Local Error Resume Next
  751.     currLine = SendMessage(R1.hwnd, EM_LINEFROMCHAR, -1&, ByVal 0&) + 1
  752.     'MsgBox Format$(currLine, "##,###")
  753.  StatusBar1.Panels(1).Text = "Line: " + Format$(currLine, "##,###")
  754. linelock = Format$(currLine, "##,###")
  755. StatusBar1.Panels(5).Text = "Line locked: " + linelock
  756. End Sub
  757. Private Sub Splitx_Click()
  758. Form2.Show
  759. End Sub
  760. Private Sub Start_Click()
  761. xxx = "#!/usr/bin/perl" + vbCrLf
  762. Clipboard.SetText xxx
  763. R1.SelText = Clipboard.GetText
  764. End Sub
  765. Private Sub subedit_Click()
  766. End Sub
  767. Private Sub Timer1_Timer()
  768.     Dim currLine As Long
  769.     thechar = R1.SelStart
  770.     Dim lineCount As Long
  771.  StatusBar1.Panels(1).Text = "Char: " + thechar
  772.     On Local Error Resume Next
  773.     currLine = SendMessage(R1.hwnd, EM_LINEFROMCHAR, -1&, ByVal 0&) + 1
  774.     lineCount = SendMessage(R1.hwnd, EM_GETLINECOUNT, 0&, ByVal 0&)
  775.     'MsgBox Format$(currLine, "##,###")
  776.  StatusBar1.Panels(2).Text = "Line: " + Format$(currLine, "##,###")
  777.  StatusBar1.Panels(3).Text = "Total Lines: " + Format$(lineCount, "##,###")
  778. End Sub
  779. Private Sub Timer2_Timer()
  780. selholder = R1.SelText
  781. selmid = Mid(selholder, 1, 20)
  782. Curseltext.Caption = "---> Current seltext: " + selmid + "..."
  783. End Sub
  784. Private Sub ToHTML_Click()
  785. Dim holder As String
  786. xxx = R1.SelText
  787. xxx = Replace(xxx, "\" + Chr(34), Chr(34), 1, -1)
  788. xxx = Replace(xxx, "\n", "", 1, -1)
  789. xxx = Replace(xxx, "print " + Chr(34), "", 1, -1)
  790. xxx = Replace(xxx, Chr(34) + ";", "", 1, -1)
  791. R1.SelText = xxx
  792. End Sub
  793. Private Sub ToPerl_Click()
  794. xxx = ""
  795. Dim i As Variant
  796. Dim MyString, myArray
  797. MyString = Split(R1.SelText, vbCrLf, -1, 1)
  798. For Each i In MyString
  799. i = Replace(i, Chr(34), "\" + Chr(34))
  800. If i = "" Or i = vbCrLf Then
  801. i = "print " + Chr(34) + i + "\n" + Chr(34) + ";"
  802. End If
  803. xxx = xxx + i + vbCrLf
  804. xxx = xxx + "/"
  805. xxx = Replace(xxx, vbCrLf + "/", "")
  806. R1.SelText = xxx
  807. End Sub
  808. Private Sub Undo_Click()
  809.     'If gintIndex = 0 Then Exit Sub
  810.     'gblnIgnoreChange = True
  811.     'gintIndex = gintIndex - 1
  812.     On Error Resume Next
  813.     'R1.TextRTF = gstrStack(gintIndex)
  814.     'gblnIgnoreChange = False
  815. SendMessage R1.hwnd, EM_UNDO, gintIndex, 0
  816. 'SendMessage R1.hwnd, EM_SCROLLCARET, 0, 0
  817. End Sub
  818. Public Sub Update_Click()
  819. Vars.List2.Clear
  820. Vars.List1.Clear
  821. If codecolen.Checked = False Then
  822. Exit Sub
  823. End If
  824. R1.MousePointer = rtfArrowHourglass
  825. Dim holdpos
  826. 'MsgBox sellenghtx
  827. holdpos = R1.SelStart
  828. If selstartx > 0 Then
  829. R1.SelStart = selstartx
  830. R1.SelLength = sellenghtx
  831. R1.SelStart = 0
  832. R1.SelLength = Len(R1.Text)
  833. End If
  834. Dim alldata As String
  835. alldata = R1.SelText
  836. R1.Visible = False
  837. Dim position
  838. Dim startp
  839. startp = 0
  840. position = 1
  841. Dim foundstr
  842. Do While Not position = 0
  843. position = InStr(startp + 1, alldata, "$", vbTextCompare)
  844. If position > 0 Then
  845. R1.SelStart = position - 1
  846. R1.SelLength = 15
  847. foundstr = R1.SelText
  848. Dim currchar
  849. Dim i As Integer
  850. For i = 2 To 25
  851. currchar = Mid(foundstr, i, 1)
  852. If currchar = "{" Or _
  853. currchar = " " Or _
  854. currchar = ")" Or _
  855. currchar = "," Or _
  856. currchar = "/" Or _
  857. currchar = "]" Or _
  858. currchar = Chr(34) Or _
  859. currchar = "'" Or _
  860. currchar = "<" Or _
  861. currchar = ";" Or _
  862. currchar = "\" Or _
  863. currchar = "-" Or _
  864. currchar = "." Or _
  865. currchar = ":" Or _
  866. currchar = "(" Or _
  867. currchar = "}" Or _
  868. currchar = "[" Or _
  869. currchar = "#" Then
  870. Exit For
  871. End If
  872. R1.SelLength = i - 1
  873. R1.SelColor = &HC000&
  874. Vars.List1.AddItem R1.SelText
  875. startp = position
  876. End If
  877. startp = 0
  878. position = 1
  879. Do While Not position = 0
  880. position = InStr(startp + 1, alldata, "print ", vbTextCompare)
  881. If position > 0 Then
  882. R1.SelStart = position - 1
  883. R1.SelLength = 5
  884. R1.SelColor = QBColor(9)
  885. startp = position
  886. End If
  887. startp = 0
  888. position = 1
  889. Do While Not position = 0
  890. position = InStr(startp + 1, alldata, "if ", vbTextCompare)
  891. If position > 0 Then
  892. R1.SelStart = position - 1
  893. R1.SelLength = 2
  894. R1.SelColor = QBColor(9)
  895. startp = position
  896. End If
  897. startp = 0
  898. position = 1
  899. Do While Not position = 0
  900. position = InStr(startp + 1, alldata, "else", vbTextCompare)
  901. If position > 0 Then
  902. R1.SelStart = position - 1
  903. R1.SelLength = 4
  904. R1.SelColor = QBColor(9)
  905. startp = position
  906. End If
  907. startp = 0
  908. position = 1
  909. Do While Not position = 0
  910. position = InStr(startp + 1, alldata, "open ", vbTextCompare)
  911. If position > 0 Then
  912. R1.SelStart = position - 1
  913. R1.SelLength = 4
  914. R1.SelColor = QBColor(9)
  915. startp = position
  916. End If
  917. startp = 0
  918. position = 1
  919. Do While Not position = 0
  920. position = InStr(startp + 1, alldata, "close", vbTextCompare)
  921. If position > 0 Then
  922. R1.SelStart = position - 1
  923. R1.SelLength = 5
  924. R1.SelColor = QBColor(9)
  925. startp = position
  926. End If
  927. startp = 0
  928. position = 1
  929. Do While Not position = 0
  930. position = InStr(startp + 1, alldata, "elsif ", vbTextCompare)
  931. If position > 0 Then
  932. R1.SelStart = position - 1
  933. R1.SelLength = 4
  934. R1.SelColor = QBColor(9)
  935. startp = position
  936. End If
  937. R1.Visible = True
  938. R1.SelStart = 0
  939. R1.SelLength = 0
  940. R1.SetFocus
  941. R1.SelStart = holdpos
  942. R1.SelColor = &H0&
  943. R1.MousePointer = rtfDefault
  944. selstartx = 0
  945. sellenghtx = 0
  946. 'Dim i
  947. Dim holder
  948. holder = ""
  949. 'Vars.List1.Clear
  950. If Vars.List1.ListCount = 0 Then
  951. Exit Sub
  952. Vars.Show
  953. End If
  954. For i = 0 To Vars.List1.ListCount - 1
  955. If Vars.List1.List(i) = holder Then
  956. Vars.List2.AddItem (Vars.List1.List(i))
  957. End If
  958. holder = Vars.List1.List(i)
  959. End Sub
  960. Public Sub checkcolor()
  961. Dim holdpos
  962. holdpos = R1.SelStart
  963. If thechar > 10 Then
  964. R1.SelStart = thechar - 10
  965. R1.SelStart = 1
  966. End If
  967. R1.SelLength = thechar + 20
  968. Dim alldata As String
  969. alldata = R1.SelText
  970. Dim varposit
  971. varposit = InStr(1, alldata, "$", vbTextCompare)
  972. ''''''''''''''''''''
  973. R1.SelStart = holdpos + varposit
  974. R1.SelLength = 10
  975. Dim foundstr
  976. foundstr = R1.SelText
  977. Dim currchar
  978. Dim i As Integer
  979. For i = 1 To 10
  980. currchar = Mid(foundstr, i, 1)
  981. If currchar = "{" Or _
  982. currchar = " " Or _
  983. currchar = ")" Or _
  984. currchar = "," Or _
  985. currchar = "/" Or _
  986. currchar = "]" Or _
  987. currchar = Chr(34) Or _
  988. currchar = "'" Or _
  989. currchar = "<" Or _
  990. currchar = ";" Or _
  991. currchar = "\" Or _
  992. currchar = "-" Or _
  993. currchar = "." Or _
  994. currchar = ":" Or _
  995. currchar = "(" Or _
  996. currchar = "}" Or _
  997. currchar = "[" Or _
  998. currchar = "#" Then
  999. Exit For
  1000. End If
  1001. R1.SelStart = holdpos + varposit
  1002. R1.SelLength = i - 1
  1003. ''''''''''''''''''''
  1004. R1.SelColor = &H80FF&
  1005. R1.SelStart = holdpos
  1006. End Sub
  1007. Public Sub selectword()
  1008. If thechar > 0 Then
  1009. End If
  1010. End Sub
  1011. Private Sub Variables_Click()
  1012. Vars.Show
  1013. End Sub
  1014.